<?php
/**
 * sqc @小T科技 2018.03.06
 *
 *
 */
namespace App\Logic;

use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\Validator;
use App\Models\Appointment;


class AppointmentLogic
{
    public function __construct()
    {
        
    }
    
    static public function addApo($apoInfo)
    {
        //         if (empty(\Auth::user()->id)) {
        //             $user_id = 0;
        //         } else {
        //             $user_id = \Auth::user()->id;
        //         }

        $user_id = 8;
        
        $newApo = new Appointment();

        $info = $newApo->where(['uid' => $user_id,'sid'=>$apoInfo->sid])->first();
        if (empty($info->id)) {
            //预约不存在
            $newApo->uid = $user_id;
            $newApo->sid = $apoInfo->sid;
            $newApo->uid = $user_id;
            $newApo->user_name = $apoInfo->userName;
            $newApo->mobile = $apoInfo->mobile;
            $newApo->at_time = $apoInfo->at_time;
            return $newApo->save();
        }
    }

    
}
